
<?php include './application/views/top.php'; ?>
<script src="/static/js/ajaxfileupload.js"></script>
<script src="/static/js/formCheck.js"></script>

<div class="clear"></div>
<div class="user_bottom all"></div>
<div class="clear h50"></div>
<div class="layout uc">
	<?php include './application/views/user/left.php'; ?>
	<div class="right">
		<div class="menu_list"><?php include './application/views/user/menu.php'; ?></div>
		<div class="cont">
        <?php if(isset($vipinfo['vip_status']) && $vipinfo['vip_status'] == 1 && $vipinfo['kefu_userid'] > 0){ ?>
        	<div class="tishi"><?php if(time()>$vipinfo['vip_verify_time']+3600*24*365){?>您的VIP已过期。<?php }else{?>您已经是尊贵的VIP会员。【专属客服：<?php echo $kefu_list[$vipinfo['kefu_userid']]['username'];?>】<?php }?></div>
		<?php }else if(isset($vipinfo['vip_status']) && $vipinfo['vip_status'] == 2){?>
			<div class="tishi">您已申请VIP会员，请等待审核。</div>
		<?php }else{ ?>
			<?php if (isset($vipinfo['vip_status']) && $vipinfo['vip_status'] == 1 && $vipinfo['kefu_userid'] == 0){?>
        	<div class="tishi">您已经是尊贵的VIP会员，请选择VIP专属客服</div>
        	<?php }?>
            <form id="vip_form" action="/user/vip" method="POST">
            <input type="hidden" name="act" value="submit">
			<dl class="line">
				<dt>请选择客服：</dt>
                <dd>
					<select name="kefu_userid">
						<option value="0">请选择客服</option>
						<?php foreach($kefu_list as $val){ ?>
						<option value="<?php echo $val['user_id'];?>"><?php echo $val['username'];?></option>
						<?php } ?>
					</select>
                </dd>
			</dl>
			<div class="cb">
            <?php if (isset($vipinfo['vip_status']) && $vipinfo['vip_status'] == 1 && $vipinfo['kefu_userid'] == 0){?>
            <input class="button" type="button" value="确认" onclick="vipSubmit()" />
            <?php }else{?>
            <input class="button" type="button" value="申请VIP" onclick="return vipSubmit();" />
            <?php }?>
            </div>
            </form>                           
                            <script>
                                function conf(){
                                    $('#dialog').dialog({
                                        modal:true,
                                        title:'系统提示',
                                        buttons:{"确定":function(){vipSubmit();},"取消":function(){$(this).dialog("close");}},
                                        close: function() {
                                        }
                                    });
                                    var vipmoney = <?php echo VIP_MONEY;?>;
                                    if(vipmoney > 0){
                                        $("#msg").html("VIP认证需要扣费"+vipmoney+"元");
                                    }else{
                                        $("#msg").html("确定申请成为VIP会员吗？");
                                    }
                                }

                                function vipSubmit(){
                                    var options = {
                                        url : '/user/vip',
                                        clearForm :true,
                                        resetForm :true,
                                        //beforeSubmit:  checkForm,
                                        dataType: "json",
                                        type:"post",
                                        success : function(ret) {
                                            $('#dialog').dialog({
                                                modal:true,
                                                title:'系统提示',
                                                buttons:{"确定":function(){$(this).dialog("close");}},
                                                close: function() {
                                                    if(ret.url==''){
                                                        window.location='/user/vip.html';
                                                    }else{
                                                        window.location=ret.url;
                                                    }
                                                }
                                            });
                                            $("#msg").html(ret.msg);
                                        }
                                    };
                                    $("#vip_form").ajaxSubmit(options);
                                    return false;
                                }

                            </script>
		<?php } ?>
		</div>
	 </div>
</div>
<div class="clear h50"></div>
<?php include "./application/views/footer.php";?>